//
// Copyright (c) 2024 BPer
//
#ifndef SRC_BPERRTC_BPERRTCSESSION_H_
#define SRC_BPERRTC_BPERRTCSESSION_H_

#include <bperrtc/BPerPlay.h>
#include <bperrtc/BPerPushH.h>
#include <bperrtc/BPerPushH264.h>
#include <bperrtc/BPerPushH265.h>
#include <bperrtc/BPerPushAudio.h>
#include <bperrtc/BPerBandwidth.h>
#include <bperrtc/BPerRtcContext.h>
#include <bperrtc/BPerPushStream.h>
#include <bperrtc/BPerDatachannel.h>

#include <bperice/BPerIce.h>
#include <bperutil/sys/BPerCTimer.h>
#include <bperrtp/BPerRtcpCompound.h>

typedef struct {
	BPerBool isSendDtls;
	BPerBool isSendStun;
	BPerBool enableDatachannel;
	int32_t startRecv;
	int32_t activeState;

	BPerBool isControlled;
	int32_t h264PayloadType;
	int32_t h265PayloadType;
	int32_t audioPayloadType;

	int64_t lastStunTime;
	int64_t sessionTimeout;

	BPerRtpBuffer *playRtpBuffer;


#if	BPer_Enable_RTC_Audio
	BPerRtpBuffer *pushAudioRtpBuffer;
	BPerPushAudio *pushAudio;
	BPerAudioParam *remote_audio;
#endif

#if	BPer_Enable_RTC_Video
	BPerRtpBuffer *pushVideoRtpBuffer;
	BPerPushH264 *pushH264;
	#if BPer_Enable_H265_Encoding
	BPerPushH265 *pushH265;
	#endif

	#if BPer_Enable_AV1_Encoding
	BPerPushAV1 *pushAV1;
	#endif
	#if BPer_Enable_MJpeg_Encoding
	BPerPushMjpeg *pushMjpeg;
	#endif
#endif
	//BPerTimer* 20ms;
	BPerCTimer *tm_1s;
	BPerCTimer *tm_100ms;

	BPerRtcPush *push;
	BPerRtcPlay *play;
#if BPer_Enable_Datachannel
	BPerDatachannel *datachannel;
#endif


	BPerVideoParam *remote_video;

	BPerRtcContext context;
	BPerRtpPacket pushPacket;
	BPerRtcpCompound rtcp_compound;
	BPerAudioCodec audioCodec;
	BPerVideoCodec videoCodec;
	BPerIce ice;

	char remote_fingerprint[128];
	char remoteIcePwd[64];
	char remote_ufrag[32];
	char localIcePwd[64];
	char local_ufrag[16];
} BPerRtcSession;

#endif /* SRC_BPERRTC_BPERRTCSESSION_H_ */
